package com.maxima.attendance.daos;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import com.maxima.attendance.utils.HibernateUtils;

public class AdminDAO {
	public boolean checkLogin(String uname, String pass) {
		Session session = HibernateUtils.getSession();
		session.beginTransaction();
		int x = 0;
		try {
			x = session.createQuery("select a from Administrator a where a.username= '" + uname + "' and password= '" + pass + "'").list().size();
		}
		catch (HibernateException e) {
			e.printStackTrace();
			// session.getTransaction().rollback();
		}
		// session.getTransaction().commit();
		session.close();
		return (x > 0);
	}
}
